Client Side Template

:escape

Description

Escapes HTML elements in a field.

The escape directive can be placed inside a placeholder for a field to HTML encode the field's value.

{fieldName:escape}

For example, if you had this set of JSON data and wanted to escape the value of the "content" field:

[
    {
        "data": [
            {"content": "this\"ismyvalue"},
            {"content": "<somebrackets>"},
            {"content": "&Ampersands&"}
        ]
    }
]

You could create the following template:

{data}
{*header}<h2>Data Content:</h2>{/*header}
{content:escape}<br/>
{/data}

The resulting output would be:

<h2>Data Content:</h2>
this&quot;ismyvalue<br>
&lt;somebrackets&gt;<br>
&amp;Ampersands&amp;<br>

And would be rendered in the browser or mobile app similar to what is shown below:

Data Content:

this"ismyvalue
<somebrackets>
&Ampersands&